<template>
    <div class="edu-page-warp">
        <el-card shadow="never" body-style="padding: 24px 24px 6px 24px;">
            <el-form
                ref="queryForm"
                :model="queryForm"
                :label-position="labelPosition"
                label-width="auto"
            >
                <!--本科生页面-->
                <div v-if="progress.deptId == '1'">
                    <el-col :span="12">
                        <el-row>
                            <el-col :span="12">
                                <el-form-item :label="$t('progress.courseCode') + '：'">
                                    <template>{{progress.courseCode}}</template>
                                </el-form-item>
                            </el-col>
                            <el-col :span="12">
                                <el-form-item :label="$t('progress.courseSeq') + '：'">
                                    <template>{{progress.courseSeq}}</template>
                                </el-form-item>
                            </el-col>
                            <el-col :span="12">
                                <el-form-item :label="$t('progress.courseName') + '：'">
                                    <template>{{progress.courseName}}</template>
                                </el-form-item>
                            </el-col>
                            <el-col :span="12">
                                <el-form-item :label="$t('progress.faculty') + '：'">
                                    <template>{{progress.facultyI18n}}</template>
                                </el-form-item>
                            </el-col>
                            <el-col :span="12">
                                <el-form-item :label="$t('progress.teachers') + '：'">
                                    <template>{{progress.teacherNames}}</template>
                                </el-form-item>
                            </el-col>
                            <el-col :span="12">
                                <el-form-item :label="$t('progressDetail.assistant') + '：'">
                                    <template>{{progress.assist}}</template>
                                </el-form-item>
                            </el-col>
                            <el-col :span="12">
                                <el-form-item :label="$t('progress.formLearning')+'：'">
                                    <template>{{progress.teachingWay}}</template>
                                </el-form-item>
                            </el-col>
                            <el-col :span="12">
                                <el-form-item :label="$t('progressDetail.retraining')+'：'">
                                    <template>{{progress.classType==1?"否":"是"}}</template>
                                </el-form-item>
                            </el-col>
                            <el-col :span="12">
                                <el-form-item :label="$t('progressDetail.contentOpen')+'：'">
                                    <template>{{progress.isShow=='1'?"是":"否"}}</template>
                                </el-form-item>
                            </el-col>
                            <el-col :span="12" v-if="progress.deptId != '1'">
                                <el-form-item :label="$t('progressDetail.teachingType')+'：'">
                                    <template>{{progress.teachingTypeI18n}}</template>
                                </el-form-item>
                            </el-col>
                            <el-col :span="12">
                                <el-form-item :label="$t('progress.formExaming') + '：'">
                                    <template>{{progress.formExamingIdI18n}}</template>
                                </el-form-item>
                                <el-form-item v-show="progress.formExamingId==9">
                                    <template>{{progress.otherExamName}}</template>
                                </el-form-item>
                            </el-col>
                            <el-col :span="12"></el-col>
                            <!--未审核时 审核信息不显示-->
                            <div v-if="progress.status == '3'||progress.status == '4'">
                                <el-col :span="12">
                                    <el-form-item :label="$t('progress.auditPerson') + '：'">
                                        <template>{{progress.auditPersonName}}</template>
                                    </el-form-item>
                                </el-col>
                                <el-col :span="12">
                                    <el-form-item :label="$t('progress.auditType') + '：'">
                                        <template>{{progress.statusI18n}}</template>
                                    </el-form-item>
                                </el-col>
                                <el-col :span="12">
                                    <el-form-item :label="$t('progress.auditOpinion') + '：'">
                                        <template>{{progress.auditOption}}</template>
                                    </el-form-item>
                                </el-col>
                                <el-col :span="12">
                                    <el-form-item :label="$t('progress.auditAt') + '：'">
                                        <template>{{progress.auditAt}}</template>
                                    </el-form-item>
                                </el-col>
                            </div>
                        </el-row>
                    </el-col>
                    <el-col :span="12">
                        <el-row>
                            <el-form-item>{{$t('progressDetail.scorePercent')+"："}}</el-form-item>
                        </el-row>
                        <el-row
                            v-for="(item,index) in items"
                            :label="item.label"
                            :key="index"
                        >
                            <el-col :span="6" v-if="item.examName"> {{item.examName}}</el-col>
                            <el-col :span="6">
                                <el-form-item>
                                    <template>{{item.value}}%</template>
                                </el-form-item>
                            </el-col>
                        </el-row>
                    </el-col>
                </div>
                <!--研究生页面-->
                <div v-if="progress.deptId != '1'">
                    <el-col :span="24">
                        <el-row>
                            <el-col :span="6">
                                <el-form-item :label="$t('progress.courseCode') + '：'">
                                    <template>{{progress.courseCode}}</template>
                                </el-form-item>
                            </el-col>
                            <el-col :span="6">
                                <el-form-item :label="$t('progress.courseSeq') + '：'">
                                    <template>{{progress.courseSeq}}</template>
                                </el-form-item>
                            </el-col>
                            <el-col :span="6">
                                <el-form-item :label="$t('progress.courseName') + '：'">
                                    <template>{{progress.courseName}}</template>
                                </el-form-item>
                            </el-col>
                            <el-col :span="6">
                                <el-form-item :label="$t('progress.teachers') + '：'">
                                    <template>{{progress.teacherNames}}</template>
                                </el-form-item>
                            </el-col>
                            <!-- <el-col :span="6">
                                <el-form-item :label="$t('progressDetail.assistant') + '：'">
                                    <template>{{progress.assist}}</template>
                                </el-form-item>
                            </el-col> -->
                            <el-col :span="6">
                                <el-form-item :label="$t('progress.faculty') + '：'">
                                    <template>{{progress.facultyI18n}}</template>
                                </el-form-item>
                            </el-col>
                            <el-col :span="6">
                                <el-form-item :label="$t('progress.formLearning')+'：'">
                                    <template>{{progress.teachingWay}}</template>
                                </el-form-item>
                            </el-col>
                            <el-col :span="6">
                                <el-form-item :label="$t('progressDetail.contentOpen')+'：'">
                                    <template>{{progress.isShow=='1'?"是":"否"}}</template>
                                </el-form-item>
                            </el-col>
                            <el-col :span="6" >
                                <el-form-item :label="$t('progressDetail.teachingType')+'：'">
                                    <template>{{progress.teachingTypeI18n}}</template>
                                </el-form-item>
                            </el-col>
                            <el-col :span="6">
                                <el-form-item v-show="progress.formExamingId==9">
                                    <template>{{progress.otherExamName}}</template>
                                </el-form-item>
                            </el-col>
                            <!--未审核时 审核信息不显示-->
                            <div v-if="progress.status == '3'||progress.status == '4'">
                                <el-col :span="6">
                                    <el-form-item :label="$t('progress.auditPerson') + '：'">
                                        <template>{{progress.auditPersonName}}</template>
                                    </el-form-item>
                                </el-col>
                                <el-col :span="6">
                                    <el-form-item :label="$t('progress.auditType') + '：'">
                                        <template>{{progress.statusI18n}}</template>
                                    </el-form-item>
                                </el-col>
                                <el-col :span="6">
                                    <el-form-item :label="$t('progress.auditOpinion') + '：'">
                                        <template>{{progress.auditOption}}</template>
                                    </el-form-item>
                                </el-col>
                                <el-col :span="6">
                                    <el-form-item :label="$t('progress.auditAt') + '：'">
                                        <template>{{progress.auditAt}}</template>
                                    </el-form-item>
                                </el-col>
                            </div>
                        </el-row>
                    </el-col>
                </div>
            </el-form>
            <span style="font-size:14px;color:red;float:left">注意：教学内容中不允许安排学生自习，查阅文献（实践类课程除外）</span>
        </el-card>
        <el-card shadow="never" body-style="padding: 24px;">
            <EduTable
                :order="true"
                @page-change="pageChange"
                :data="tableData.list"
                :total="tableData.total_"
                @selection-change="handleSelectionChange"
                row-style="height:50px"
            >
                <el-table-column :label="$t('progress.classTime')">
                    <template
                        slot-scope="scope"
                        v-if="scope.row.rowDeleteFlag !=1"
                    >第{{scope.row.weekNumber}}周 星期{{scope.row.dayOfWeek}} 第{{scope.row.timeStart}}节-第{{scope.row.timeEnd}}节</template>
                </el-table-column>
                <el-table-column :label="$t('progress.classContent')" show-overflow-tooltip>
                    <template slot-scope="scope">{{scope.row.classContent}}</template>
                </el-table-column>
                <el-table-column :label="$t('progress.realTeacher')">
                    <template slot-scope="scope">{{scope.row.teacherNames}}</template>
                </el-table-column>
                <el-table-column :label="$t('progress.realAddress')">
                    <template slot-scope="scope">{{scope.row.roomName}}</template>
                </el-table-column>
                <el-table-column :label="$t('progress.remark')">
                    <template slot-scope="scope">{{scope.row.remark}}</template>
                </el-table-column>
                <el-table-column :label="$t('progress.comment')" show-overflow-tooltip>
                    <template slot-scope="scope">
                        <el-input v-model="scope.row.comment" maxlength="50" :disabled="commentHideFlag"></el-input>
                    </template>
                </el-table-column>
            </EduTable>
        </el-card>
    </div>
</template>

<script>
import * as API from "common/src/api/progress/progressList";
export default {
    name: "progressAudit",
    props: {
        content: {
            default: null
        },
        commentHideFlag:{
            default:false
        }
    },
    data() {
        return {
            labelPosition: "right",
            tableData: {
                list: [],
                total_: 0
            },
            queryForm: {
                condition: {
                    id: "",
                    keywords: ""
                },
                pageNum_: 1,
                pageSize_: 20
            },
            progress: {
                isFlag: "",
                courseCode: "",
                courseSeq: "",
                courseName: "",
                faculty: "",
                isShow: "",
                operator: "",
                status: "",
                createdAt: "",
                shortExchange: "",
                longExchange: "",
                formExamingId: "",
                auditPerson: "",
                auditType: "",
                auditOption: "",
                auditAt: "",
                auditCode: ""
            },
            form: {} /*提交表单*/,
            progressList: [],
            commentFlag:false
        };
    },
    methods: {
        blurComment() {
            this.getById(this.content.teachingProgress.id)
            // this.$emit("updateComment", this.tableData.list,this.form.teachingClassId,this.progress);
        },
        pageChange(page) {
            this.queryForm.pageNum_ = page.pageNum;
            this.queryForm.pageSize_ = page.pageSize;
            this.getById(this.queryForm.condition.id);
        },
        getById(id) {
            this.queryForm.condition.id = id;
            API.getPageContentById(this.queryForm).then(resp => {
                if (resp.code == 200) {
                    this.progress = resp.data.teachingProgress;
                    this.items = resp.data.teachingProgress.gradesList;
                    // this.examList = resp.data.teachingProgress.examList;
                    this.tableData.list = resp.data.progressContents.list;
                    this.tableData.total_ = resp.data.progressContents.total_;
                    this.form.teachingClassId = resp.data.teachingProgress.teachingClassId;
                    this.$listeners.updateComment&&this.$emit("updateComment", this.tableData.list,this.form.teachingClassId,this.progress);
                }
            });
        }
    }
};
</script>

<style scoped>
</style>
